# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=luacheck
pkgver=0.26.1
pkgrel=0
pkgdesc="A tool for linting and static analysis of Lua code"
url="https://github.com/lunarmodules/luacheck"
arch="noarch"
license="MIT"
_luaversion="5.1"
depends="
	lua$_luaversion
	lua$_luaversion-argparse
	lua$_luaversion-filesystem
	"
makedepends="
	lua-argparse
	lua-filesystem
	"
checkdepends="
	lua$_luaversion-busted
	lua$_luaversion-luautf8
	lua$_luaversion-socket
	"
source="https://github.com/lunarmodules/luacheck/archive/v$pkgver/$pkgname-$pkgver.tar.gz"

check() {
	busted-$_luaversion .
}

package() {
	local lmod_dir="$pkgdir/usr/share/lua/$_luaversion"

	mkdir -p "$lmod_dir"
	cp -r src/$pkgname "$lmod_dir"/

	install -D -m 755 bin/$pkgname.lua "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
fdd9fea8e0028dfefac3b0b4699cebfc2d1bfc0b56e3e426886cb5763957ff1f83cbc2178d0eddbe9691145832284b1ddd89b176dada900de05fece09f233dfb  luacheck-0.26.1.tar.gz
"
